package collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("做什么");
        list.add("吃什么");
        list.add("喝什么");
        list.add("看什么");
        list.add("做什么");
        System.out.println(list);
    String a=list.get(2);
        System.out.println(a);
        Iterator<String> it=list.iterator()
;
        while (it.hasNext()){
            System.out.println(it.next());
        }
        a=list.set(2,"l");
        System.out.println(list);
        String s= list.remove(2);
        System.out.println(list);
        System.out.println(s);
        list.add(1,"网吧");
        System.out.println(list);

    }
}
